﻿namespace LuckyAssetManagerContrib.Configuration
{
	using System.Configuration;

	/// <summary>
	/// Configuration settings of HTTP-handler, responsible 
	/// for text output of processed asset
	/// </summary>
	public sealed class AssetsHandlerElement : ConfigurationElement
	{
		/// <summary>
		/// Duration of storage text content of processed 
		/// asset in browser cache (in days)
		/// </summary>
		[ConfigurationProperty("clientCacheDurationInDays", DefaultValue = 15)]
		[IntegerValidator(MinValue = 0, MaxValue = 365, ExcludeRange = false)]
		public int ClientCacheDurationInDays
		{
			get { return (int)this["clientCacheDurationInDays"]; }
			set { this["clientCacheDurationInDays"] = value; }
		}

		/// <summary>
		/// Enables GZIP/Deflate-compression of processed asset
		/// </summary>
		[ConfigurationProperty("enableCompression", DefaultValue = true)]
		public bool EnableCompression
		{
			get { return (bool)this["enableCompression"]; }
			set { this["enableCompression"] = value; }
		}

		/// <summary>
		/// Enables using HTTP-header "Last-Modified" for notify 
		/// browser about change files of processed asset
		/// </summary>
		[ConfigurationProperty("useLastModifiedHeader", DefaultValue = true)]
		public bool UseLastModifiedHeader
		{
			get { return (bool)this["useLastModifiedHeader"]; }
			set { this["useLastModifiedHeader"] = value; }
		}

		/// <summary>
		/// Enables using HTTP-header "ETag" for notify browser 
		/// about change files of processed asset
		/// </summary>
		[ConfigurationProperty("useETagHeader", DefaultValue = true)]
		public bool UseETagHeader
		{
			get { return (bool)this["useETagHeader"]; }
			set { this["useETagHeader"] = value; }
		}
	}
}
